﻿package controllers 
{
	import model.MainModel;
	import model.Photo;
	
	/**
	 * ...
	 * @author Slavshik Alexander
	 */
	public class PhotoController 
	{
		private var currentPhoto:int = 0;
		
		public function PhotoController() {
		}
		public function selectAlbum(id:int) {
			currentPhoto = 0;
			MainModel.selectedAlbum = MainModel.albums[id];
		}
		public function get hasNextPhoto():Boolean {
			return !(currentPhoto + 1 > MainModel.selectedAlbum.photos.length - 1);
		}
		public function getNextPhoto():Photo {
			if (!hasNextPhoto) return null;
			currentPhoto++;
			return MainModel.selectedAlbum.photos[currentPhoto];
		}
		public function get hasPrevPhoto():Boolean {
			return !(currentPhoto - 1 <= 0);
		}
		public function getPrevPhoto():Photo {
			if (!hasPrevPhoto) return null;
			currentPhoto--;
			return MainModel.selectedAlbum.photos[currentPhoto];
		}
		
	}
	
}